<?php 
include_once('./configs/config.php');
if ($_COOKIE["liheid"]==$_GET[key]){
header("Location: back.php?key=".$_GET[key]); 
exit;
}
if (""==$_GET[key]){
echo  "<script language=JavaScript>alert('参数出错!');location.href='index.php';</script>";
exit;
}

$allkaiid=$_COOKIE["allkaiid"];
$allkaiidarr = explode(",",substr($allkaiid,0,strlen($allkaiid)-1));
foreach($allkaiidarr as $u){
    $strarr = explode(",",$u);
    foreach($strarr as $newstr){
   if ($_GET[key]==$newstr){
$chaiguo=1;
   }else{
   }
   }
}

if($chaiguo!=1){
$allkaiid=$_COOKIE["allkaiid"].$_GET[key].",";
setcookie("allkaiid",$allkaiid, time()+360000);
$kaiid=mysql_query("INSERT INTO 510_lihekai (`id` ,`kid` ,`ip` ,`kdate` )VALUES (NULL , '".$_GET[key]."', '".$_SERVER["REMOTE_ADDR"]."', '".date("Y-m-d H:i")."');");
}

?><!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title><?php if($chaiguo!=1){echo "拆开啦！感谢您的帮忙！";}else{echo "你已经拆开过这个礼盒了";}?></title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script type="text/javascript" src="template/wb/js/zepto.js"></script>
<style type="text/css">
body{padding:0;margin:0;font-size:14px;font-family:Arial;}h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{margin:0;padding:0;}dl,dt,dd,ul,li,ol{list-style:none;}img{border:0;}.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden}
body{background:url(template/wb/images/tb.png) repeat-x;background-size:1px 324px;}
.main{width:100%;}
.main .box{width:100%;height:324px;background:url(template/wb/images/bg.jpg) center 0 no-repeat;background-size:320px 324px;display:block;}
.main .title{line-height:30px;font-size:18px;color:#fff;text-align:center;text-shadow:1px 1px 0 #d28ea7;padding-top:20px;}
.main .cont{width:100%;height:257px;text-align:center;overflow:hidden;}
.main .btn{width:100%;text-align:center;margin:5px auto;}
.main .btn span{display:inline-block;width:145px;height:49px;line-height:49px;background:url(template/wb/images/button_1.png) no-repeat;background-size:145px 49px;color:#fff;font-size:18px;text-align:center;margin:0 5px;}
#btn_box{background:url(template/wb/images/button_3.png) no-repeat;background-size:145px 49px;}
#grey_bg{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(51,51,51,0.8);z-index:1000;display:none;}
#grey_bg p{float:right;width:320px;text-align:center;color:#fff;font-size:20px;line-height:1.4em;background:url(template/wb/images/jt.png) 250px 10px no-repeat;background-size:40px 40px;padding-top:55px;}
.ling{
	font-weight: bold;
	color: #FFF;
	text-align: center;
	font-size: 16px;
	line-height: 1.5em;
}
</style>

</head>

<body><link rel="stylesheet" type="text/css" href="bdad.css">
<div class="main">
	<div class="box">
		<div class="title" id="title"><?php if($chaiguo!=1){echo "拆开啦！太感谢你了！";}else{echo "你已经拆过此礼盒了";}?><br />
        <strong>你也赶快去领一个<br>咱们一起学习，共同进步</strong></div>
		<div class="cont"><img src="template/wb/images/box1.png" width="210" height="210" id="boximg" /></div>
	</div><!--/box-->
<div class="btn"><span onClick="window.location='index.php'">我也领一个</span></div>
	<div class="grey_bg" id="grey_bg" onClick="showBg(0)">
		<p>就差一点点了<br />点击右上角【发送给朋友】<br />【分享到朋友圈】<br />召唤更多小伙伴<br /></p>
	</div>
</div><!--/main-->



<script language="javascript">
var mebtnopenurl = "<?php echo $wxwz?>back.php?key=<?php echo $_GET[key];?>";
var timeLineLink = "<?php echo $wxwz?>back.php?key=<?php echo $_GET[key];?>";
var box_id='1';
function openBox(){
	$("#btn_box").hide();
	if(state==1){
		$("#title").html('谢谢你啦<br />你也赶快去领一个吧');
		$("#boximg").attr("src",'template/wb/images/box_open_'+box_id+'.png');
		var url='sub/share_add.php?rnd='+Math.random();
		$.post(url,{user_id:user_id,bid:bid},function(data){
                });	
	}
}
$(function(){
	addLoadEvent(preloader);//预加载
})

//预加载
function preloader(){
    if(document.images){
        var img1=new Image();
        var img2=new Image();
        var img3=new Image();
		var img4=new Image();
        var img5=new Image();
		img1.src="template/wb/images/gift1.png";
        img2.src="template/wb/images/gift2.png";
        img3.src="template/wb/images/gift3.png";
		img4.src="template/wb/images/gift4.png";
        img5.src="template/wb/images/gift5.png";
    }
}
function addLoadEvent(func){
    var oldonload=window.onload;
    if (typeof window.onload!='function'){
        window.onload=func;
    }else{
        window.onload=function(){
            if(oldonload){
                oldonload();
            }
            func();
        }
    }
}
function showBg(n){
	if(n){
		$("#grey_bg").show();
	}else{
		$("#grey_bg").hide();
	}

}
window.onload=function(){
	
		//showBg(1);
	
}
</script>
<script type="text/javascript" src="template/wb/js/share_2.js"></script>


<div style="display:none;"></div>
</body>
</html>
